package com.hanfusion.vertx;

import io.vertx.core.AbstractVerticle;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.handler.StaticHandler;

/**
 * @author hankChan
 *         2018/5/4 0004.
 */
public class VertxMain extends AbstractVerticle {

    @Override
    public void start() throws Exception {
        Router router = Router.router(vertx);
        router.route().handler(StaticHandler.create());
        vertx.createHttpServer().requestHandler(req -> {
            // TODO ... 业务逻辑处理
            req.response().putHeader("content-type", "application/json;charset=UTF-8")
                    .end("{'msg':'Hello Vertx'}");
        }).listen(80);
    }
}
